#include "Student.h"
#include <iostream>
#include <vector>

int main()
{
  int n;
  std::cin >> n;
  Student *arr = new Student[n]; //分配长度为n的数组内存空间，元素类型为Student
  int a;
  char b;
  double c;
  for (int i = 0; i < n; i++)   //读入n个学生信息
    {
      std::cin >> a >> b >> c;
      arr[i].change_std_no(a); 
      arr[i].change_major(b);
      arr[i].change_GPA(c);
    };
  Heap *arr_sort = new Heap(arr, n);
  arr_sort->sort_m();
  std::cout << "Students sorted by major:" << std::endl;
  Student* A = (*arr_sort).get_A();
  for (int i = 0; i < n; i++)
    A[i].printout();;
  arrange(A, 0, n-1);
  std::cout << "Students sorted by GPA:" << std::endl;
  for (int i = 0; i < n; i++)
    A[i].printout();

  return 0;
};
  
  
